package com.teaching.management.entity;

import jakarta.persistence.*;
import lombok.Data;
import java.time.LocalTime;

@Data
@Entity
@Table(name = "course")
public class Course {
    @Id
    @Column(name = "course_id")
    private String courseId;

    @Column(name = "name", nullable = false)
    private String name;

    @Column(name = "credit", nullable = false)
    private Integer credit;

    @Column(name = "total_hours", nullable = false)
    private Integer totalHours;

    @Column(name = "semester", nullable = false)
    private String semester;

    @Column(name = "classroom_id", nullable = false)
    private String classroomId;

    @Column(name = "teacher_id", nullable = false)
    private String teacherId;

    @Column(name = "major", nullable = false)
    private String major;

    @Column(name = "course_type", nullable = false)
    private String courseType;

    @Column(name = "year", nullable = false)
    private Integer year;

    @Column(name = "class_day", nullable = false)
    private String classDay;

    @Column(name = "period_id", nullable = false)
    private Integer periodId;

    @Column(name = "start_time", nullable = false)
    private LocalTime startTime;

    @Column(name = "end_time", nullable = false)
    private LocalTime endTime;

    @Column(name = "weeks")
    private String weeks;

    @Column(name = "location_detail")
    private String locationDetail;

    @Column(name = "description")
    private String description;

    @Transient
    private Integer studentCount;

    @ManyToOne
    @JoinColumn(name = "classroom_id", insertable = false, updatable = false)
    private Classroom classroom;

    @ManyToOne
    @JoinColumn(name = "teacher_id", insertable = false, updatable = false)
    private Teacher teacher;

    @ManyToOne
    @JoinColumn(name = "period_id", insertable = false, updatable = false)
    private ClassPeriod classPeriod;
}